import {Mongo} from 'meteor/mongo';
import {Meteor} from 'meteor/meteor'
export const LoginUsers=new Mongo.Collection('login');
export const UserGroup=new Mongo.Collection('userGroup');
export const Right=new Mongo.Collection('right');
export const UserLog=new Mongo.Collection('userLog');
// export const Register=new Mongo.Collection('register');

Meteor.users.allow({ remove: () => true });
Meteor.users.allow({ update: () => true });
Meteor.users.allow({ insert: () => true });

// 存储文件
import { FilesCollection } from 'meteor/ostrio:files';
export const SaveFile = new FilesCollection({debug:true,collectionName: 'file'});

if(Meteor.isServer){
    Meteor.startup(function () {
        // SaveFile.load('https://raw.githubusercontent.com/VeliovGroup/Meteor-Files/master/logo.png', {
        //   fileName: 'logo.png',
        //   meta: {}
        // });
      });
      Meteor.publish('collection',function(){
        return SaveFile.find().cursor;
    })
    Meteor.publish('collectiona',function(){
        return UserGroup.find();
    })
    Meteor.publish('users',function(){
        return Meteor.users.find();
    })
    Meteor.publish('right',function(){
        return Right.find();
    })
    Meteor.publish('UserLog',function(){
        return UserLog.find();
    })
}else{
    Meteor.subscribe('collection')
    Meteor.subscribe('collectiona')
    Meteor.subscribe('users')
    Meteor.subscribe('right')
    Meteor.subscribe('UserLog')
}


